﻿using System.Web.Mvc;

using SimpleForum.Utils;
using SimpleForum.Classes.Core.Providers;

namespace SimpleForum.Controllers
{
    public class BaseController : Controller
    {
        protected IdentityProvider Identity
        {
            get
            {
                if (User.Identity is IdentityProvider) return (IdentityProvider)User.Identity;
                else return null;
            }
        }

        [NonAction]
        protected ActionResult Notification(NotificationHelper.NotificationTypes NotificationType, string Message)
        {
            ViewBag.NotificationType = NotificationType;
            ViewBag.Message = Message;

            return View("Error");
        }

        [NonAction]
        protected ActionResult EntityNotFound()
        {
            return Notification(NotificationHelper.NotificationTypes.Error, "Not found.");        
        }
    }
}